package com.cloudfun.campusshare.repo;

import com.cloudfun.campusshare.entity.WashPointConcretePositionEntity;
import com.cloudfun.campusshare.entity.WashPointEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

/**
 * @author : zhangyongjie
 * @version : 1.0
 * @createTime : 2020/4/28 19:28
 * @description :
 */
@Repository
public interface WashPointConcretePositionEntityRepo extends JpaRepository<WashPointConcretePositionEntity,String>, JpaSpecificationExecutor<WashPointConcretePositionEntity> {
    /**
     * 删除位置
     * @param washPointId
     * @return
     */
    int deleteAllByWashPointId(String washPointId);


    WashPointConcretePositionEntity findByIdAndWashPointId(String id,String washPointId);


    List<WashPointConcretePositionEntity> findAllByWashPointId(String washPointId);

    int deleteAllByIdIn(Collection<String> ids);


    @Query(value = "select * from wash_point_concrete_position where wash_point_id in(select id from wash_point where merchant_id=?1)",nativeQuery = true)
    List<WashPointConcretePositionEntity> findAllPlaces(String merchantId);
}
